//
//  SecondViewController.m
//  27-Block
//
//  Created by 曹曹 on 16/8/19.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import "SecondViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"这里是一个标题";
    self.view.backgroundColor = [UIColor greenColor];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回上一页" style:UIBarButtonItemStylePlain target:self action:@selector(goBack)];
}

- (void)goBack {
    if (_passTitle) {
        self.passTitle(self.title);
    }
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)dealloc {
    NSLog(@"SecondVC被释放");
    // MRC下释放block
    Block_release(_passTitle);
    // blcok置空
    _passTitle = nil;
    [super dealloc];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
